﻿using System.Collections.Generic;
using BLL.Services.Friends.Listing;

namespace BLL.Services.Friends
{
    public class FriendsService : IFriendsService
    {
        private readonly FriendsCollection _friendsCollection;

        public FriendsService(FriendsCollection friendsCollection)
        {
            _friendsCollection = friendsCollection;
        }

        public ListingFriends GetListingFriend(int userId,int page,int size,string column,int direction,ListingFriendsFilter filter)
        {
            return _friendsCollection.GetListingFriend(userId,page, size,column, direction, filter);
        }

        public void Create(int userId, int friendId,bool isAccepted)
        {
            _friendsCollection.AddFriendToUser(userId,friendId,isAccepted);
        }

        public IEnumerable<Friend> GetFriendsByUser(int userId)
        {
            return _friendsCollection.FriendByUserId(userId);
        }

        public void Delete(int userId, int friendId)
        {
            _friendsCollection.Delete(userId,friendId);
        }

        public void Update(int userId, int friendId, bool isAccepted)
        {
            _friendsCollection.Update(userId, friendId, isAccepted);
        }


        public void SetFriend(int userId, int friendId)
        {
            _friendsCollection.SetFiend(userId,friendId);
        }

        public ListingFriendsIsAccepted GetFriendIsAcceptedListing(int userId,int page,int size,string column,int direction,FriendsIsAcceptedFilter filter)
        {
            return _friendsCollection.GetFriendsListingIsAccepted(userId,page,size,column,direction,filter);
        }

         public SocialFriends GetFriendsByUserId(int userId)
         {
             return _friendsCollection.GetFriendsByUserId(userId);
         }

        public SocialFriends GetFriendsRequests(int userId)
        {
            return _friendsCollection.GetFriendsRequests(userId);
        }
    }
}
